#include <algorithm>
#include <vector>
using namespace std;
int findMinArrowShots(vector<vector<int>> &points) {
  // 先按左边界排序
  sort(points.begin(), points.end(),
       [](const vector<int> &a, const vector<int> &b) { return a[0] < b[0]; });
  // 计算需要的弓箭数
  int count = 1;
  for (int i = 1; i < points.size(); ++i) {
    if (points[i][0] > points[i - 1][1]) {
      count++;
    } else {
      points[i][1] = min(points[i - 1][1], points[i][1]);
    }
  }
  return count;
}